/**
 * 
 */
package com.an.springbean;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;

/**
 * @author 86171
 *
 */
public class MyBeanPostProcessor implements BeanPostProcessor {
	@Override
	public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
	
		if("car".equals(beanName)) {
			Car car = (Car) bean;
			if(car.getColor() == null) {
				System.err.println("查漏补缺，调用BeanPostProcessor.postProcessBeforeInitialization(),color为空设置为黑色");
car.setColor("黑色         -------------");
			}
			
		}
	return bean;
	}
}
